{include file="public/header" /}
<body class="hide-top bgc">
<div class="draw-container">
    <img src="/static/index/img/icon32.png" alt="">
    <div class="draw-content">
        <div class="draw-hd">
            <i class="layui-icon layui-icon-left" onclick="goBack()"></i> 邀请好友
        </div>
        <img src="/static/index/img/icon33.png" class="share-name" alt="">
        <div class="share-news">
            <img src="/static/index/img/icon34.png" alt="">
            <div>
                <p>邀请码</p>
                <p class="code">{$user.code}</p>
                <p class="flex-center QRcode"></p>
                <input type="hidden" id="copy" value="{$url}">
                <p class="copy save" data-clipboard-target="#copy">复制链接</p>
            </div>
        </div>
    </div>
</div>
</body>
{include file="public/footer" /}
<script src="/static/index/js/qrcode.min.js"></script>
<script src="/static/index/js/clipboard.min.js"></script>
<script src="/static/index/js/utf.js"></script>
<script>
    $(function () {
        $(".QRcode").qrcode({
            render: "canvas", //设置渲染方式，有table和canvas
            text: '{$url}', //扫描二维码后自动跳向该链接
            width: "130", //二维码的宽度
            height: "130", //二维码的高度
            background: "#ffffff", //二维码的后景色
            foreground: "#000000", //二维码的前景色
            //src: 'images/logo.png', //二维码中间的图片
        });
        $('.copy').click(function () {
            var clipboard = new ClipboardJS('.copy',{
                text: function() {
                    return $("#copy").val();
                }
            });
            clipboard.on("success", function (e) {
                e.clearSelection();
                layer.msg('复制成功')
            });
            clipboard.on("error", function (e) {
                layer.msg('复制失败')
            });
        });
    });
</script>
</html>